Add session description baggage support - #80
Merged
Conversation
- Add GEN_AI_SESSION_DESCRIPTION_KEY constant - Add sessionDescription() fluent setter to BaggageBuilder - Update GENERIC_ATTRIBUTES to propagate session description - Add tests for sessionDescription in BaggageBuilder and SpanProcessor - Update sample agent to use sessionDescription Co-authored-by: fpfp100 <126631706+fpfp100@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add session description baggage support in observability
Add session description baggage support
Nov 20, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request adds OpenTelemetry baggage propagation support for session descriptions, enabling contextual session metadata to flow through distributed traces alongside existing baggage attributes.
- Introduces a new
GEN_AI_SESSION_DESCRIPTION_KEYconstant for the baggage key - Adds a fluent
sessionDescription()setter toBaggageBuilderfollowing existing patterns - Enables automatic propagation of session description from baggage to span attributes
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/agents-a365-observability/src/tracing/constants.ts | Adds GEN_AI_SESSION_DESCRIPTION_KEY constant alongside existing agent/session constants |
| packages/agents-a365-observability/src/tracing/middleware/BaggageBuilder.ts | Adds sessionDescription() fluent setter method and improves type safety in setPairs() method (changes any to unknown) |
| packages/agents-a365-observability/src/tracing/processors/util.ts | Includes session description key in GENERIC_ATTRIBUTES array for span enrichment |
| tests/observability/core/BaggageBuilder.test.ts | Adds test coverage for session description baggage entry setting and null value handling |
| tests/observability/core/SpanProcessor.test.ts | Verifies session description propagates from baggage to span attributes |
| tests-agent/basic-agent-sdk-sample/src/agent.ts | Demonstrates usage by adding session description to baggage builder chain |
nikhilNava
requested changes
Nov 20, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ps://github.com/microsoft/Agent365-nodejs into copilot/add-session-description-baggage-support
fpfp100
enabled auto-merge (squash)
November 20, 2025 19:35
nikhilNava
requested changes
Nov 20, 2025
nikhilNava
approved these changes
Nov 21, 2025
nikhilNava
deleted the
copilot/add-session-description-baggage-support
branch
November 21, 2025 12:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds OpenTelemetry baggage propagation for session descriptions, enabling contextual metadata to flow through distributed traces.
Changes
GEN_AI_SESSION_DESCRIPTION_KEY = 'gen_ai.session.description'to OpenTelemetry constantssessionDescription(value: string | null | undefined)fluent setter using existingsethelperGEN_AI_SESSION_DESCRIPTION_KEYinGENERIC_ATTRIBUTESarray for automatic span attribute enrichmentUsage
Original prompt
This pull request was created as a result of the following prompt from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.